/*
 * @Author: your name
 * @Date: 2021-07-22 14:23:38
 * @LastEditTime: 2021-07-23 16:35:31
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \cuiyuan_activity\assets\script\Ticket.ts
 */
// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const { ccclass, property } = cc._decorator;
import { getStore, setStore } from "./Utils";

@ccclass
export default class Ticket extends cc.Component {



    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        let submitData = getStore('submitData', true)
        let avatar = cc.find('avatar', this.node).getComponent(cc.Sprite)
        let QR = cc.find('QR', this.node).getComponent(cc.Sprite)
        let name = cc.find('name', this.node).getComponent(cc.Label)
        cc.assetManager.loadRemote('https://images.pexels.com/photos/3905698/pexels-photo-3905698.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260', (error, texture) => {
            let frame = new cc.SpriteFrame(texture);
            avatar.spriteFrame = frame;
        });
        cc.assetManager.loadRemote('https://images.pexels.com/photos/278430/pexels-photo-278430.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260', (error, texture) => {
            let frame = new cc.SpriteFrame(texture);
            QR.spriteFrame = frame;
        });
        // if (submitData.name) {

        //     name.string = submitData.name
        // }
    }

    init() {

    }

    start() {

    }

    // update (dt) {}
}
